package cn.gok.oop;

class Animal{
    private String name;
    private String sex;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void call(){
        System.out.println(this.name+"发出叫声");
    }

    public Animal() {
    }

    public Animal(String name, String sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", age=" + age +
                '}';
    }
}
class Dog extends Animal{
    public Dog() {
        super("giao", "公", 18);
    }

    public Dog(String name, String sex, int age) {
        super("狗", "公", 18);
    }
}
public class 继承 {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.call();
    }
}
